package com.mondo.financialwallet.data.repository;

import com.mondo.financialwallet.data.entity.mapper.DefaultDataEntityMapper;
import com.mondo.financialwallet.data.repository.datasource.DefaultDataStore;
import com.mondo.financialwallet.data.repository.datasource.RemoteDefaultDataStore;
import com.mondo.financialwallet.domain.interactor.PostUserLogin;
import com.mondo.financialwallet.domain.interactor.PostUserRegister;
import com.mondo.financialwallet.domain.model.HoldProduct;
import com.mondo.financialwallet.domain.model.HoldProductProfit;
import com.mondo.financialwallet.domain.model.Product;
import com.mondo.financialwallet.domain.model.ProductOrder;
import com.mondo.financialwallet.domain.model.Response;
import com.mondo.financialwallet.domain.model.User;
import com.mondo.financialwallet.domain.model.UserAsset;
import com.mondo.financialwallet.domain.repository.DefaultRepository;

import java.io.File;
import java.util.List;

import io.reactivex.Observable;

public class DefaultDataRepository implements DefaultRepository {

    private DefaultDataEntityMapper mapper;
    private DefaultDataStore remoteDefaultDataStore;

    public DefaultDataRepository() {
        mapper = new DefaultDataEntityMapper();
        remoteDefaultDataStore = new RemoteDefaultDataStore();
    }

    @Override
    public Observable<Response<User>> userDetails() {
        return remoteDefaultDataStore.userDetails().map(mapper::transform);
    }

    @Override
    public Observable<Response<UserAsset>> userAssets() {
        return remoteDefaultDataStore.userAssets().map(mapper::transform);
    }

    @Override
    public Observable<Response<Void>> modifyAvatar(File avatar) {
        return remoteDefaultDataStore.modifyAvatar(avatar).map(mapper::transform);
    }

    @Override
    public Observable<Response<Void>> register(PostUserRegister.Params params) {
        return null;
    }

    @Override
    public Observable<Response<User>> login(PostUserLogin.Params params) {
        return null;
    }

    @Override
    public Observable<Response<Void>> alterNickname(String nickname) {
        return remoteDefaultDataStore.alterNickname(nickname).map(mapper::transform);
    }

    @Override
    public Observable<Response<Void>> resetLoginPassword() {
        return null;
    }

    @Override
    public Observable<Response<Void>> alterLoginPassword() {
        return null;
    }

    @Override
    public Observable<Response<Void>> bindNewMobileNumber() {
        return null;
    }

    @Override
    public Observable<Response<Void>> bindEmail() {
        return null;
    }

    @Override
    public Observable<Response<List<Product>>> productList() {
        return null;
    }

    @Override
    public Observable<Response<List<ProductOrder>>> productOrderList() {
        return remoteDefaultDataStore.productOrderList().map(mapper::transform);
    }

    @Override
    public Observable<Response<List<HoldProduct>>> holdProductList() {
        return remoteDefaultDataStore.holdProductList().map(mapper::transform);
    }

    @Override
    public Observable<Response<HoldProduct>> holdProductDetails(String orderNumber) {
        return remoteDefaultDataStore.holdProductDetails(orderNumber).map(mapper::transform);
    }

    @Override
    public Observable<Response<List<HoldProductProfit>>> holdProductProfitData(String orderNumber) {
        return null;
    }

    @Override
    public Observable<Response<Void>> clearHoldProduct() {
        return null;
    }
}
